<div class="main-content">
	<header>
		<a href="<?php echo bu('admin/links/new'); ?>" class="fr button button-gray">Add Links</a>
		<h2>Links</h2>
	</header>

	<section>
		<table class="datatable paginate sortable full">
			<thead>
			<tr>
				<th>Title</th>
				<th>For</th>
				<th>Created At</th>
				<th>Modified At</th>
				<th style="width:70px"></th>
			</tr>
			</thead>
			<tbody>
			<?php foreach ($links as $link){ ?>
			<tr>
				<td align="center"><a href="<?php echo $link->url; ?>"><?php echo $link->title; ?></a></td>
				<td align="center"><?php if(isset($link->member)){ echo $link->member->name; }else{ echo "Everyone"; } ?></td>
				<td align="center"><?php echo Helpers::customDate($link->created_at); ?></td>
				<td align="center"><?php echo Helpers::customDate($link->modified_at); ?></td>
				<td>
				<ul class="action-buttons">
					<li><a href="<?php echo bu('admin/links/edit'); ?>?id=<?php echo $link->id; ?>" class="button button-gray no-text"><span class="pencil"></span>Edit</a></li>
					<li><a href="<?php echo bu('admin/links/delete'); ?>?id=<?php echo $link->id; ?>" method="POST" class="button button-gray no-text"><span class="bin"></span>Delete</a></li>
				</ul>
				</td>
			</tr>
			<?php } ?>
			</tbody>
		</table>
	</section>
</div>